<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title>ResampleAudio Avisynth Filter</title>
   <link rel="stylesheet" type="text/css" href="../../avisynth.css">
</head>
<body >
<h2>
<a NAME="ResampleAudio"></a>ResampleAudio
</h2>
<p><code>ResampleAudio </code>(<var>clip, int new_rate_numerator[, int new_rate_denominator]</var>)
<p><code><tt>ResampleAudio</tt></code> performs a high-quality change of audio
samplerate. The conversion is skipped if the samplerate is already at the given rate.</p>
<p>When using fractional resampling the output audio samplerate is given by :<br>
<pre>int(new_rate_numerator / new_rate_denominator + 0.5)</pre>
However the internally the resampling factor used is :
<pre>new_rate_numerator / (new_rate_denominator * old_sample_rate)</pre>
This causes the audio duration to vary slightly (which is generally what is desired).</p>
<p>Starting from <em>v2.53</em> <tt>ResampleAudio</tt> accepts any number of channels.
<br>Starting from <em>v2.56</em> <tt>ResampleAudio</tt> process float samples
directly. Support fractional resampling.</p>
<br>
<pre># resamples audio to 48 kHz
source = AviSource(&quot;c:\audio.wav&quot;)
return ResampleAudio(source, 48000)</pre>
<br>
<pre># Exact 4% speed up for Pal telecine
Global Nfr_num=25
Global Nfr_den=1
AviSource(&quot;C:\Film.avi&quot;) # 23.976 fps, 44100Hz
Ar=Audiorate()
ResampleAudio(Ar*FramerateNumerator()*Nfr_den, FramerateDenominator()*Nfr_num)
AssumeSampleRate(Ar)
AssumeFPS(Nfr_num, Nfr_den, False)</pre>
<p>For exact resampling the intermediate samplerate needs to be 42293.706293
which if rounded to 42294 would causes about 30ms per hour variation.
<p><kbd>$Date: 2005/10/03 16:49:04 $</kbd></p>
<form><input TYPE="Button" VALUE="Back"
onClick="history.go(-1)"></form>
</body>
</html>
